local skill = fk.CreateSkill{
  name = "tea__shanji",
}
---@type ActiveSkillSpec
local shanji = {
  anim_type = "support",
  target_filter = Util.FalseFunc,
  card_filter = Util.FalseFunc,
  can_use = function(self, player)
    return player:usedSkillTimes(skill.name, Player.HistoryPhase) == 0 and #player:getCardIds("h") > 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    room:moveCardTo(player:getCardIds("h"), Card.DrawPile, nil, fk.ReasonPut, skill.name, nil, false, player)
    for _, p in ipairs(room.alive_players) do
      if p:isWounded() and not p.dead then
        local choice = room:askToChoice(p, {
          choices = {"shanji_recover", "shanji_drawcards"},
          skill_name = skill.name,
          prompt = "#tea__shanji_choose"
        })
        if choice == "shanji_drawcards" then
          p:reset()
          if not player.dead then
            p:drawCards(1, skill.name)
          end
        else
          room:recover{
            who = p,
            num = 1,
            skillName = skill.name,
          }
        end
      end
    end
  end,
}
skill:addEffect("active", shanji)
return skill